package hibernate.p;

public class Unit {
	private static Unit chinese=new Unit("CHINESE_YUAN");
	private static Unit us=new Unit("US_DOLLAR");
	private static Unit euro=new Unit("EURO");
	private String name;
	private Unit(String n){
		this.name=n;
	}
	public static Unit getChinese(){return chinese;}
	public static Unit getUs(){return us;}
	public static Unit getEuro(){return euro;}
	
	public static Unit parseUnit(String str){
		if(str.equals(chinese.toString()))
			return chinese;
		else if(str.equals(us.toString()))
			return us;
		else if(str.equals(us.toString())) 
			return euro;
		else return null;
	}
	
	public String toString(){return name;}
}
